<template>
    <div>
        <van-search v-model="value" shape="round" background="#4fc08d" placeholder="请输入搜索关键词" />
        <div v-for="item in searchApiData">
            <van-card num="2" price="2.00" :desc="item.is_promote" :title="item.goods_name"
                :thumb="goods_small_logo ?goods_small_logo :'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
        </div>
    </div>
</template>

<script setup>
import { ref, watch } from 'vue'
import { searchApi } from '@/api/api'
const value = ref()
const searchApiData = ref([])
watch(value, (val) => {
    //   console.log(`Count is: ${count}`)


    searchApi(val).then((res) => {
        console.log('搜索', res);
        searchApiData.value = res.data.message.goods
    })
})


</script>

<style lang="scss" scoped></style>